package com.workerhelping.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.workerhelping.dao.RecordDao;
import com.workerhelping.po.Record;
import com.workerhelping.service.RecordService;
import org.springframework.stereotype.Service;

@Service
public class RecordServiceImpl extends ServiceImpl<RecordDao, Record> implements RecordService {

    @Override
    public Integer insertRecord(Record record) {
        baseMapper.insert(record);
        return record.getId();
    }

    @Override
    public Record getRecordByWorkerId(Integer id) {
        QueryWrapper<Record> queryWrapper = new QueryWrapper<Record>().eq("w_id", id);
        Record record = baseMapper.selectOne(queryWrapper);
        return record;
    }

    @Override
    public void updateRecordByRecordId(Record record) {
        baseMapper.updateById(record);
    }
}
